<?php
	session_start();
 	include_once('header.php'); 
?>
	<?PHP
		function check_lang() { 
		if(isSet($_GET['lang']))
		{
			$lang = $_GET['lang'];
			
			// register the session and set the cookie
			$_SESSION['lang'] = $lang;
			
		}
		else if(isSet($_SESSION['lang']))
		{
			$lang = $_SESSION['lang'];
		}
		else if(isSet($_COOKIE['lang']))
		{
			$lang = $_COOKIE['lang'];
		}
		else
		{
			$lang = 'en';
		}
		
		//directory name 
		  $dir = 'languages'; 
		
		//no we return the langauge wanted ! 
		//Returned String Format: dirname/filename.ext 
		  return "$dir/$lang.lng"; 
	} 
	?>
	<?PHP
	//this function will check user language and return the file name to be included .. 
	$lang = check_lang();
	$_SESSION['abc'] = 'room1';
	include($lang); 
	?>
	<div id="wrapper1">
		<!-- Header : ---------------------  Start -------------------------
			Describle : banner + logo + search + link (english, vietnam, rss)-->	
		<div id="header" class="container" align="center">
			<!-- text link -->
			<div style="float:left; margin:40px 30px auto; font-size:18px; color:#666666">
				<b> Site map | 
				<a onclick="developfunction('')" id="english" 
					onmouseover="change_color_link('english', '#000000')" 
					onmouseout="change_color_link('english', '#666666')"
					href="bookinfo.php?lang=en" > 
						English </a> | 
				<a onclick="refreshView()" id="vietnam" 
					onmouseover="change_color_link('vietnam', '#000000')" 
					onmouseout="change_color_link('vietnam', '#666666')"
					href="bookinfo.php?lang=vn"> 
						Vietnam </a> | 
				<a id="rss" onclick="developfunction('')"
					onmouseover="change_color_link('rss', '#000000')" 
					onmouseout="change_color_link('rss', '#666666')"
					> 
						RSS </a></b>			</div>
			
<?php include_once('menu.php'); ?>
<?php require_once("database.php");
	$link = connectDB();
	$sql = "SELECT room.id
			,roomName
			,roomNo
			,room.serviceId as serviceId
			,(SELECT vn FROM services WHERE services.id = room.serviceId) as serviceName
			FROM room
			WHERE room.id = ". $_GET['id'];
	$result = mysql_query($sql,$link);
	$row = mysql_fetch_row($result);
?>
<div style="width:100%">
<form action="savebookinfo.php" method="post">
	<h3>Đặt phòng</h3>
    <table><tbody>
    <tr>
    	<td>Loại phòng:</td>
        <td>
        	<input type="hidden" name="serviceId" value="<?php echo $row[3] ?>" />
            <?php echo $row['4']; ?>
        </td>
    </tr>
    <tr>
    	<td>Phòng:</td>
        <td>
        	<input type="hidden" name="roomId" value="<?php echo $row[0] ?>" />
            <?php echo $row['1']." - ".$row['2']; ?>
        </td>
    </tr>
    <tr>
    	<td>
        	Từ ngày: 
        </td>
        <td>
        	<input type="hidden" name="inputDate" value="<?php echo  $_SESSION['inputDate'] ?>" />
            <?php echo $_SESSION['inputDate'] ?> 
        </td>
    </tr>
    <tr>
    	<td>
        	Đến ngày: 
        </td>
        <td>
        	<input type="hidden" name="outputDate" value="<?php echo $_SESSION['outputDate'] ?>" />
            <?php echo $_SESSION['outputDate'] ?> 
        </td>
    </tr>
    <tr>
    	<td>
        	Họ tên khách hàng: 
        </td>
        <td>
        	<input type="text" name="customerName" value="" />
        </td>
    </tr>
    <tr>
    	<td>
        	Điện thoại: 
        </td>
        <td>
        	<input type="text" name="phoneNumber" value="" />
        </td>
    </tr>
    <tr>
    	<td>
        	Email: 
        </td>
        <td>
        	<input type="text" name="email" value="" />
        </td>
    </tr>
    <tr>
    	<td align="center" colspan="2">
        	<input type="submit" name="Book" value="Đặt phòng" />
            <input type="reset" name="Reset" value="Xóa form" />
        </td>
    </tr>
    </tbody></table>
</form>
</div>

<?php include_once('footer.php'); ?>